<!--
# Copyright (c) 2024 Bird Software Solutions Ltd
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
#    Neil Mackenzie - initial API and implementation
-->
{% extends 'base.html' %}

{% block content %}
<p style="text-align: center;"> <a href="{% url 'pybirdai:create_bird_database'%}">Back to the Create Database Page</a><p>
<h1>Create Database Manual Steps</h1>

These steps create a database for storing financial data such as bonds and loans following the BIRD datamodel.<br><br>
FreeBIRD Application uses the Django framework; by default Django uses the sqlite database but it can be conigured to use other databases like Postgres, Oracle or SQLServer<br><br>

<p>To create the database, do these things manually from the command line:<br><br>

Stop the server by hitting CTRL-C in the terminal or command window running the django server.<br><br>

If you previously created the database, yout will need to delete the old one. This can be done by deleting the db.sqlite3 file in the birds_nest directory.<br><br>

Look in birds_nest\results\database_configuration directory for the results which is a models.py file and an admin.py file. <br><br>

Copy the content of models.py into birds_nest\pybirdai\bird_data_model.py<br><br>

Using an  editor, append the contents of the birds_nest\results\admin.py file (except for the first line ‘from django.contrib import admin’ to birds_nest\pybirdai\admin.py<br><br>

Make sure those files are saved. <br><br>

In the terminal/command line make sure you are in the birds_nest directory , if not type cd .\birds_nest\ to change into that directory<br><br>
run the command in the terminal: python manage.py makemigrations pybirdai <br><br>

This might take a few minutes for the LDM, but it should be quick for the Input Layer<br><br>


run the command in the terminal: python manage.py migrate <br><br>

you will see some warnings like ‘ SQLite does not support comments on columns (db_comment) ‘ which is fine<br><br>

You can log into the database and do some queries now if you wish<br><br>

make the admin user: <br><br>

python manage.py createsuperuser <br><br>

complete the prompts for user name , email and password<br><br>

If you are using the LDM, you will need to enable an automotic import of the TYP_INSTRMNT and TYP_ACCNTNG_ITM variable later from a CSV file. This can be done by creating a csv file or getting it from the github repository <a href="https://github.com/regcommunity/FreeBIRD/blob/main/initial_correction/variable_typ_instrmnt.csv">here</a> and storing it in the birds_nest\resources\extra_variables directory named as extra_variables.csv<br><br>

Lastly,run the command in the terminal to restart the server:  python manage.py runserver<br><br>

go to back to website and choose Check the autogenerate UI<br><br>
</p>



   

{% endblock %}